package com.polaris.live.adapter.party

import android.view.LayoutInflater
import android.view.ViewGroup
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CircleCrop
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.polaris.live.R
import com.polaris.live.databinding.AdapterInvitingSeatBinding
import com.polaris.live.im.sfs.bean.live.ext.UserBasicVo
import com.polaris.live.utils.image.ImageUtils
import com.polaris.live.widget.avatar.FrameImageUtils

/**
 *  邀请上座
 * @author Created by 天晴 on 2024/2/27 19:39
 * @since 1.0.0
 **/
class InvitingSeatAdapter :
    BaseQuickAdapter<UserBasicVo, InvitingSeatAdapter.InvitingSeatHolder>(0) {


    init {
        addChildClickViewIds(R.id.click_rl)
    }

    override fun onCreateDefViewHolder(parent: ViewGroup, viewType: Int): InvitingSeatHolder {
        return InvitingSeatHolder(
            AdapterInvitingSeatBinding.inflate(LayoutInflater.from(parent.context), parent, false)
        )
    }

    override fun convert(holder: InvitingSeatHolder, item: UserBasicVo) {
        holder.binding.apply {
            nameTv.text = item.nickname
            followItemCountry.setCountry(item.country)
            vipView.setVipLevel(item.vipLevel)
            myLevel.setRichCharmBySexLevel(
                item.sex,
                item.richs,
                item.charms
            )
            Glide.with(context)
                .load(ImageUtils.imgPathSmall(item.avatar))
                .transform(CircleCrop())
                .into(avatarImg)
            avFv.setFrameImage(FrameImageUtils.urlToFrameImageBean(item.avatarFrame))
        }

    }

    inner class InvitingSeatHolder(val binding: AdapterInvitingSeatBinding) :
        BaseViewHolder(binding.root) {

    }

}